package com.zhny.aiot.zx.fertilizer.ic.plugin;

import com.zhny.aiot.fertilizer.ic.plugin.FertilizerICDeviceFactory;
import com.zhny.aiot.fertilizer.ic.plugin.FertilizerICEngine;
import com.zhny.aiot.fertilizer.ic.plugin.FertilizerIcServer;
import com.zhny.aiot.plugin.ICenterFacilities;
import com.zhny.aiot.plugin.IDevice;
import com.zhny.aiot.plugin.model.CommandEntry;
import com.zhny.aiot.plugin.model.DeviceEntity;
import com.zhny.aiot.plugin.model.FactoryType;
import com.zhny.aiot.plugin.model.StoreEntity;
import com.zhny.aiot.zx.fertilizer.ic.plugin.device.FertilizerIcDevice;
import com.zhny.aiot.zx.fertilizer.ic.plugin.model.FertilizerIcStoreEntry;
import org.pf4j.Extension;
import org.pf4j.Plugin;
import org.pf4j.PluginWrapper;

import java.util.ArrayList;
import java.util.List;

public class FertilizerIcPlugin extends Plugin {
    public FertilizerIcPlugin(PluginWrapper wrapper) {
        super(wrapper);
    }

    @Extension
    public static class FertilizerIcFactory extends FertilizerICDeviceFactory<FertilizerIcStoreEntry> {

        @Override
        public List<CommandEntry> supportCommandClasses() {
            List<CommandEntry> commands =  new ArrayList();
            commands.add(CommandEntry.valueOf("open", "启动", "无参数",null));
            commands.add(CommandEntry.valueOf("close", "关闭", "无参数",null));
            return commands;
        }

        public IDevice createDevice(ICenterFacilities iCenterFacilities, DeviceEntity entity) {
            return new FertilizerIcDevice (FertilizerIcServer.getInstance ().getEngine () ,this,iCenterFacilities,entity);
        }

        public Class<? extends StoreEntity> storeClass() {
            return FertilizerIcStoreEntry.class;
        }

        public String getId() {
            return "zx-fertilizer-ic-plugin";
        }

        public String getName() {
            return "河北赵县水肥罐IC卡插件";
        }

        public FactoryType getType() {
            return FactoryType.ICFertilizerTerminal;
        }


    }
}
